<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport"
          content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <title>{$item['title']}</title>
    <link href="{$file}/css/style.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript">
        var commonjspath = 'images';
    </script>
    <script src="{$file}/js/jquery-1.8.3.min.js" type="text/javascript" type="text/javascript"></script>
    <script src="{$file}/js/common.js" type="text/javascript" type="text/javascript"></script>
    <style>
        .pop {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            display: none;
            z-index: 1000;
            padding-top: 15%;
        }

        .content .prize ul li .jiangpin {
            position: relative;
        }

        .content .prize ul li .jiangpin span {
            position: absolute;
            width: 100%;
            text-align: center;
            bottom: 9px;
            left: 0;
            font-size: 12px;
            border-radius: 0 0 10px 10px;
            background-color: rgba(196, 43, 43, 0.57);
            color: #fff;
            padding: 5px 0;
        }
    </style>
</head>
<body>
<div id="adduser" class="pop" style="display:none;">
    <div class="promptbox">
        <div class="box"><h1>报名参加</h1>

            <div class="line"><img src="{$file}/images/line_yellow.png" width="100%"/></div>
            <div class="user">
                <form id="add_form">
                    <div class="input"><input type="text" id="xm" name="xm" placeholder="请输入姓名"/></div>
                    <div class="input id">
                        <input type="text" id="tel" name="tel" placeholder="请输入手机号，以便领取奖品"/>
                        <input type="hidden" name="act" value="add">
                        <input type="hidden" name="act_id" value="2">
                        <input type="hidden" name="tomhash" value="623608">
                        <input type="hidden" name="formhash" value="cb42a596">
                    </div>
                </form>

                <div class="but_con">
                    <button class="add_user_btn button_01 but">参加</button>
                    <button class="button_02 but" onclick="document.getElementById('adduser').style.display='none';"
                            style="margin-left:18%">关闭
                    </button>
                    <div class="clr"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="award_dialog" class="pop" style="display:none;">
    <div class="promptbox">
        <div class="box">

            <h1 id="b_title">申请领奖</h1>
            <input type="hidden" name="award_id" id="award_id" value="0">
            <input type="hidden" name="op_type" id="op_type" value="0">
            <div class="line"><img src="{$file}/images/line_yellow.png" width="100%"/></div>
           <div class="user">

                <div class="but_con">
                    <button class="get_score_btn button_01 but">确定</button>
                    <button class="button_02 but" onclick="document.getElementById('award_dialog').style.display='none';"
                            style="margin-left:18%">关闭
                    </button>
                    <div class="clr"></div>
                </div>
            </div>
        </div>
    </div>
</div>




<div id="guanzu" class="pop" style="display:none;">
    <div class="promptbox">
        <div class="box"><h1>关注我们</h1>

            <div class="line"><img src="{$file}/images/line_yellow.png" width="100%"/></div>
            <div class="user">
                <div class="text2">
                    <div align="center"><font size="4"><font
                            color="#ffff00"><strong>{$jgg['follow_welbtn']}</strong></font></font>
                    </div>
                    <div align="center"><font size="5"><strong><font color="#ffff00"> </font><a
                            href="{$jgg['follow_url']}"
                            target="_blank"><font color="#ffffff">{$jgg['follow_btn']}</font></a> </strong></font></div>
                    <div class="clr"></div>
                </div>
                <div class="but_con">
                    <button class="button_01" onclick="document.getElementById('guanzu').style.display='';">关闭</button>
                    <div class="clr"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="zjl" class="pop" onclick="document.getElementById('zjl').style.display='';document.location.reload();"
     style="display:none;">
    <div class="promptbox">
        <div class="box"><h1>恭喜您！您的运气实在太好了！</h1>

            <div class="line"><img src="{$file}/images/line_yellow.png" width="100%"/></div>
            <div class="user">
                <img id="jpimg" src="{$file}/images/common_141_no36KKnN.png" width="45%" class="left"/>

                <div class="text" style="margin-left:50%; ">
                    <span id="jptype">参与奖</span><br/>
                    <span id="jpname">谢谢参与</span><br/>
                    <img src="{$file}/images/cat_03.png" width="120"/>

                    <div class="clr"></div>
                </div>
                <div class="but_con">
                    <button class="button_01">关闭</button>
                    <div class="clr"></div>
                </div>
            </div>
        </div>
    </div>
</div>

<div id="mzj" class="pop" onclick="document.getElementById('mzj').style.display='';document.location.reload();"
     style="display:none;">
    <div class="promptbox">
        <div class="box"><h1>很遗憾没抽中</h1>

            <div class="line"><img src="{$file}/images/line_yellow.png" width="100%"/></div>
            <div class="user">
                <img src="{$file}/images/cat_02.png" width="70" class="left"/>

                <div class="text">
                    <span id="ncz">没抽中任何奖品,请继续!</span>

                    <div class="clr"></div>
                </div>
                <div class="but_con">
                    <button class="button_01">知道啦</button>
                    <div class="clr"></div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="container" id="lottery">
<div class="NO">
    <ul>
        <li class="lottery-unit lottery-unit-0"><span class="active"></span><img
               {if $award['0']['prizeImg']}   src="{$award['0']['prizeImg']}" {else} src="{$file}/images/p1.png" {/if}/>
				
        </li>
        <li class="lottery-unit lottery-unit-1"><span></span><img
             {if $award['1']['prizeImg']}   src="{$award['1']['prizeImg']}" {else} src="{$file}/images/p2.png" {/if}/>
        </li>
        <li class="lottery-unit lottery-unit-2"><span></span><img
             {if $award['2']['prizeImg']}   src="{$award['2']['prizeImg']}" {else} src="{$file}/images/p3.png" {/if}/>
        </li>
        <li class="lottery-unit lottery-unit-7"><span></span><img
                src="{$file}/images/p0.png"/>
        </li>
    

        <li><a><img src="{$file}/images/start.jpg" style="cursor:pointer;"/></a></li>

      

        <li class="lottery-unit lottery-unit-3"><span></span><img
                src="{$file}/images/p4.png"/>
        </li>
        <li class="lottery-unit lottery-unit-6"><span></span><img
                src="{$file}/images/p7.png"/>
        </li>
        <li class="lottery-unit lottery-unit-5"><span></span><img
                src="{$file}/images/p6.png"/>
        </li>
        <li class="lottery-unit lottery-unit-4"><span></span><img
                src="{$file}/images/p5.png"/>
        </li>
        <div class="clr"></div>
    </ul>
</div>
<img src="{$file}/images/bg.jpg" class="img"/>
</div>
<div class="content">
    <div class="textbox">
        <ul>
            <li>
                <div class="left_btn"><a href="{$awardurl}" onclick="">获奖名单</a></div>
            </li>
            <li>
                <div class="right_btn"><a href="javascript:void(0);"
                                          onclick="document.getElementById('guanzu').style.display='block';">关注我们</a>
                </div>
            </li>
            <div class="clr"></div>
        </ul>
    </div>
    <div class="title"><img src="{$file}/images/title_1.png"/></div>
    <div class="text">本次活动您共可以抽{$item['playTotalLimit']}次，你还剩余{$leftPlayCount}次抽奖机会；<br/>

        <br/>
        活动开始时间： {$item['starttime']}<br/>
        活动结束时间： {$item['endtime']}
    </div>
    <div class="title"><img src="{$file}/images/title_2.png"/></div>
    <div class="text">

        {$item['conment']}

    </div>

    <div class="title"><img src="{$file}/images/title_3.png"/></div>
    
<div class="line"><img src="{$file}/images/line.png"/></div>
<div class="copyright">{$jgg['copyright']}</div>
<script type="text/javascript">
      var id = '{php echo $id}';
      var token = '{php echo $token}';
	  
     var allTimes = "5";
    allTimes = allTimes * 1;

    var useTimes = "0";
    useTimes = useTimes * 1;

    var zjStatus = "0";
    zjStatus = zjStatus * 1;

    var leftCount = '{php echo $leftPlayCount}';
  //var leftCount = '2';
     

    var click = false;
    var flag = 1;
    var myindex = 7;
    var submintCjStatus = 0;
    var lottery = {
        index: 0,
        count: 0,
        timer: 0,
        speed: 1000,
        times: 0,
        cycle: 50,
        prize: -1,
        init: function (id) {
            if ($("#" + id).find(".lottery-unit").length > 0) {
                slottery = $("#" + id);
                sunits = slottery.find(".lottery-unit");
                this.obj = slottery;
                this.count = sunits.length;
                slottery.find(".lottery-unit-" + this.index).find('span').addClass("active");
            }
            ;
        },
        roll: function () {
            var index = this.index;
            var count = this.count;
            var lottery = this.obj;
            $(lottery).find(".lottery-unit-" + index).find('span').removeClass("active");
            index += 1;
            if (index > count - 1) {
                index = 0;
            }
            ;
            $(lottery).find(".lottery-unit-" + index).find('span').addClass("active");
            this.index = index;
            return false;
        },
        stop: function (index) {
            this.prize = index;
            return false;
        }
    };

    function roll() {
        lottery.times += 1;
        lottery.roll();
        if (lottery.times > lottery.cycle + 10 && lottery.prize == lottery.index) {
            clearTimeout(lottery.timer);
            lottery.prize = -1;
            lottery.times = 0;
            click = false;
            if (lottery.index < 7) {
                setTimeout('$("#zjl").show()', 1300);
            } else {
                setTimeout('$("#mzj").show()', 1300);
            }
        } else {
            if (lottery.times < lottery.cycle) {
                lottery.speed -= 10;
            } else if (lottery.times == lottery.cycle) {
                index = myindex;//Math.random()*(lottery.count)|0;
                lottery.prize = index;
            } else {
                if (lottery.times > lottery.cycle + 10 && ((lottery.prize == 0 && lottery.index == 7) || lottery.prize == lottery.index + 1)) {
                    lottery.speed += 110;
                } else {
                    lottery.speed += 20;
                }
            }
            if (lottery.speed < 40) {
                lottery.speed = 40;
            }
            ;
            lottery.timer = setTimeout(roll, lottery.speed);
        }
        return false;
    }

   
    window.onload = function () {
        lottery.init('lottery');
        $("#lottery a").click(function () {
            if (click) {
                return false;
            } else {
                if (submintCjStatus == 1) {
                    return false;
                }
                if (leftCount <= 0) {

                    $('#ncz').html('今天的机会已经用完，明日再来');
                    $('#mzj').show();
                    flag = 0;
                    return false;
                }

             
                submintCjStatus = 1;
              
                 $.ajax({
                    url: '../api.php?this=custom&token='+token+'&plugin=jy_h5game&action=choujiang&rid='+id,
                    type: "POST",
                    data: {},
                    dataType: "json",
                  
                    beforeSend: function () {
                        $('#zjl').hide();
                        $('#mzj').hide();
                    },
                    success: function (data) {
                        submintCjStatus = 0;
                     // alert(JSON.stringify(data));
					 if(data.message.errorCode == 10998){
                           $('#ncz').text(data.message.errorMsg);
                        }
                        else if (data.message.prize == 1) {
					//	alert('jjj');
                            $('#jpimg').attr("src", "../addons/jy_h5game/custom/templates/mobile/games/hd_jgg/images/p1.png");
                            $('#jptype').html("{$award['0']['prizeLevel']}");
                            $('#jpname').text("{$award['0']['prizeName']}");
                            flag = data.message.status;
                            myindex = 0;
                        } else if (data.message.prize == 2) {
                            $('#jpimg').attr("src", "../addons/jy_h5game/custom/templates/mobile/games/hd_jgg/images/p2.png");
                            $('#jptype').html("{$award['1']['prizeLevel']}");
                            $('#jpname').text("{$award['1']['prizeName']}");
                            flag = data.message.status;
                            myindex = 1;
                        } else if (data.message.prize == 3) {
                            $('#jpimg').attr("src", "../addons/jy_h5game/custom/templates/mobile/games/hd_jgg/images/p3.png");
                            $('#jptype').html("{$award['2']['prizeLevel']}");
                            $('#jpname').text("{$award['2']['prizeName']}");
                            flag = data.message.status;
                            myindex = 2;
                        } else if (data.message.prize == 4) {
                            $('#jpimg').attr("src", "../addons/jy_h5game/custom/templates/mobile/games/hd_jgg/images/p4.png");
                             $('#jptype').html("{$award['3']['prizeLevel']}");
                            $('#jpname').text("{$award['3']['prizeName']}");
                            flag = data.message.status;
                            myindex = 3;
                        } else if (data.message.prize == 5) {
                            $('#jpimg').attr("src", "../addons/jy_h5game/custom/templates/mobile/games/hd_jgg/images/p5.png");
                            $('#jptype').html("{$award['4']['prizeLevel']}");
                            $('#jpname').text("{$award['4']['prizeName']}");
                            flag = data.message.status;
                            myindex = 4;
                        } else if (data.message.prize == 6) {
                            $('#jpimg').attr("src", "../addons/jy_h5game/custom/templates/mobile/games/hd_jgg/images/p6.png");
                           $('#jptype').html("{$award['5']['prizeLevel']}");
                            $('#jpname').text("{$award['5']['prizeName']}");
                            flag = data.message.status;
                            myindex = 5;
                        } else if (data.message.prize == 7) {
                            $('#jpimg').attr("src", "../addons/jy_h5game/custom/templates/mobile/games/koi/images/p7.png");
                            $('#jptype').html("{$award['6']['prizeLevel']}");
                            $('#jpname').text("{$award['6']['prizeName']}");
                            flag = data.message.status;
                            myindex = 6;
                        } else if (data.message.prize == 0) {
                            $('#ncz').text("没抽中任何奖品,请继续!");
                            flag = data.status;
                            myindex = 7;
                        } 

                    },
                    complete: function () {
                        if (flag == 1) {
                            lottery.speed = 100;
                            roll();
                            click = true;
                            return false;
                        } else {
                            $('#mzj').show();
                            myindex = 7;
                        }
                    }
                });


            }
        });
    };

    
</script>


</body>
</html>